package cn.hpclub.server.validator.admin;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.validate.Validator;

import cn.hpclub.server.model.SysCodeValue;

public class SysCodeValueValidator extends Validator{

    @Override
    protected void validate(Controller c){
    	validateInteger("tid", 1, 999999999,"sysCodeValueTypeNameMessages", "请选择一个大类");
    }

    @Override
    protected void handleError(Controller c){
        c.keepModel(SysCodeValue.class);
        // c.setAttr("isChecked", c.getPara("class.enabled"));
        c.render("/admin/sys_code_value_input.tpl");
    }
    
    private boolean isExist(String code){
    	String sql = "select count(*) as cnt from sys_code_value where code = '" + code + "'";
    	Long cnt = Db.queryLong(sql);
    	
    	return (cnt > 0) ? true : false;
    }
}
